The present invention generally relates to the field of object-oriented computer programs and in particular to a system and method for increasing the scalability and performance of operating systems.
The Windows NT operating system automatically associates tasks to specific CPUs in a multi-processor system. That is, as new tasks are invoked, the Windows NT Operating System will assign the task to a specific processor or group of processors through its internal affinity algorithms with the goal of balancing the CPU utilization equally among all available processors. A discussion of how this is done and definitions of the relevant terms used herein is set forth hereinbelow.
Tasks are logically independent units of work whose use of the computer""s central processor(s) can be scheduled. We treat it wholly synonymous with process, the more common term in literature, and use the terms interchangeably herein.
Among other advancements Windows introduced the ability to run more than one application at a time. Although this was considered a multitasking environment, it was labeled non-preemptive multitasking. This means that when an application gains control of the system, it must return control to Windows before any other event can occur. Windows cannot interrupt (preempt) the application to perform other tasks. The heart of the Windows NT operating system is its ability to perform preemptive multi-tasking. This allows the system to schedule sections of the code, and execute them for a fixed period of time, or a time-slice. The sections of code are called threads.
Each Windows NT application has one process and at least one thread. A process is a collection of virtual memory space, code, data, and system resources. When an application starts, a process is created. A process always consists of at least one thread, known as the primary thread. From the primary thread one or more threads can be created. A thread is the unit of code that the NT operating system schedules to be performed. The main difference between a process and a thread is that threads share memory space and system resources. Processes each have there own unique memory space. Moreover, the processor executes only threads, not processes.
As pointed out above, a process can be logically divided into one or more threads, which are taken up for execution by the processor(s). Each thread includes four major sections. First, a section called ThreadProco ( ) contains pointers to the actual location of code that needs to be executed. Second, a machine register saves the state of the thread each time the time-slice for the thread expires. For example, the thread may be interrupted by the system in the middle of the function. The state of the thread is saved by storing the processor registers. The third part of a thread is a stack that stores variables during thread execution and idle time.
The thread is executed as a function of the priority of the process that created the thread and the priority of the thread itself. Once the thread has started, it will execute until it exits, unless the user specifically suspends or terminates the thread. A thread can also become blocked if there is another thread of higher priority waiting to be serviced.
In Windows NT, each process has a priority class attribute. The default class is Normal_Priority_Class. The High_Priroty_Class is reserved for critical tasks that must be performed immediately. The Idle_Priority_Class resutls in the threads of the process being executed only when the system is idle. The Real_Time_Priority_Class pushes all code to the top priority, even equal to some Windows NT system functions. The priority of a process can be set by the SetPriorityClass ( ) function in Windows NT. When a thread is created, Windows NT provides a means to set the base priority, which is Thread_Priority_Normal by default. Like the priority class, the base priority can be changed at any time by calling the SetThreadPriority.
A combination of the priority class of the process and the base priority of the thread determines when and how often the thread executes. The scheduler, which is a part of the Windows NT operating system, is responsible for making these critical decisions that determine which thread gets access to the processor. Today""s personal computers are limited by one major factor: they can only perform one instruction at a time. Since we are trying to perform multiple tasks, each task must take its turn. If more than one process is active, their threads will take turns at the microprocessor level. The scheduler tracks all threads and assigns processor time to each. It maintains a queue of all threads running on the system. Thus, it is the scheduler that plays a central role in assigning threads to a processor on the basis of a thread""s base priority along with the priority of the process to which it belongs.
In a system having multiple central processors, scheduling assumes the form of a problem having the following aspects. First, sharing of resources should be balanced so that none of the central processing units gets over-utilized or under-utilized. Second, it should be ensured that no two central processors are assigned to the same task simultaneously. Third, if one of the central processors malfunctions, the tasks running on it should be scheduled to run on alternative available central processors in accordance with their assigned priorities. Finally, the scheduler should be able to dedicate processor resources to the most critical tasks on a permanent basis.
Although the Windows NT operating system provides some or all of the above capabilities, in prior art there are no methods available to view all task/processor associations in the system. This implies that there is no way to view one or more tasks as objects that could be assigned to execute on another object representing one or more of the multiple central processing units in the system.
Another problem with prior art is that there are no methods available to associate objects representing processors to another object representing a group of processors.
Still another problem with prior art is that there is no method available to define an object representing a rule that could allow users to influence the scheduling algorithm of the operating system so that users could periodically vary the tasks associated with a processor, or a group of processors, based on the changing needs of the environment in which such a system operates.
This invention provides NT administrators with a system and method for controlling the assignment of tasks to specific CPUs using both scripting languages and a user-interface that facilitates the definition, modification, and association of processor groups and rules.
An object of this invention is to provide both a user-interface and an application programming interface that give system administrators the ability to associate NT operating system tasks with specific processor groups, which are in turn associated with specific CPUs.
Another objective of this invention is to provide a centralized view of all tasks running on the system associated with specific groupings of CPUs.
Still another objective of this invention is to provide system administrators with the ability to define rules that permit the automatic association of tasks to processor groups.
A feature of the present invention is the ability to automatically change an affinity mask assigned to a process in response to a change in the makeup of an affinity group.
These and other objects, which will become apparent as the invention is described in detail below, wherein a method in a multi-processor computing system is disclosed. The method is an object-oriented method that allows a user to make associations between processes to be executed and available CPUs of the system. In particular, the method includes the displaying of the associations for a user to manipulate. Responses are accepted by the method from a user for creating logical groupings of the CPUs, hereinafter referred to as affinity groups. Next, an affinity mask is accepted from the user for each of the affinity groups, which affinity mask assigns available ones of the CPUs. After this a determination is made as to whether or not there are more CPUs to be assigned to the affinity groups, and if not; specific rules that make associations between the processes and the affinity groups are then accepted by the method from the user.
Still other objects, features and advantages of the present invention will become readily apparent to those skilled in the art from the following detailed description, wherein is shown and described only the preferred embodiment of the invention, simply by way of illustration of the best mode contemplated of carrying out the invention. As will be realized, the invention is capable of other and different embodiments, and its several details are capable of modifications in various obvious respects, all without departing from the invention. Accordingly, the drawings and description are to be regarded as illustrative in nature, and not as restrictive, and what is intended to be protected by Letters Patent is set forth in the appended claims. The present invention will become apparent when taken in conjunction with the following description and attached drawings, wherein like characters indicate like parts, and which drawings form a part of this application.